<?php

$viewport = new FComponent('Ext.container.Viewport');
$viewport->setLayout(FLayout::BORDER_LAYOUT);

$container = new FMainContainer();

$usuario = new usuario();
$container->addIcon('Usuários', 'themes/default/images/info.png', $usuario->getForm());

$papel = new FDefaultModel('papel');
$container->addIcon('Papéis', 'themes/default/images/info.png', $papel->getForm());

$papel = new FDefaultModel('papel_usuario');
$container->addIcon('Papéis dos usuários', 'themes/default/images/info.png', $papel->getForm());

$viewport->addItem($container);

$bottomBar = new FToolbar('mainBottomBar', FLayout::HORIZONTAL_LAYOUT, FRegion::REGION_SOUTH);
$bottomBar->setBaseCls('start-menu');
$bottomBar->setHeight(36);
$bottomBar->setMinHeight(32);

// Menu
$bottomBar->addItem(new FStartMenu());

$bottomBar->addItem(new FToolbarFill());
// Hora
$bottomBar->addItem(new FLabel('lblTime', date('H:i')));
$bottomBar->addItem(new FToolbarSpacer(10));

$viewport->addItem($bottomBar);

$topBar = new FToolbar('mainTopBar');
$topBar->setHeight(24);
$viewport->addItem($topBar);

$session = new FSessionManager('login');

if ( $session->getData() instanceof FLogin )
{
    echo($viewport->generate());
}
else
{
    $login = new login();
    echo($login->getForm()->generate());
    echo($login->getForm()->show());
}

?>
